<?php
//session_start();
include('header.php');
include('menu.php');
error_reporting(E_ALL || E_STRICT);
include('Paging_outbox/paginator.class.php');
include("connection/connection.php");
$loginid=$_SESSION['loginid'];
$conn = new mysqli('localhost', 'root', '','ramky') ;
$query2="select * from tbl_dtls_compose where status='1' and receiver in('$loginid')";
$result2=mysql_query($query2);
$no_of_record1=mysql_num_rows($result2); 
if($_SERVER['HTTP_HOST']=="www.zioninformatics.com"||$_SERVER['HTTP_HOST']=="zioninformatics.com")
{
	$conn = new mysqli('localhost', 'samir696_phed', '1q2w3e4r5t6y','samir696_phed') ;
}
else
{
	$conn = new mysqli('localhost', 'root', '','ramky123_phed') ;
}
$query="select * from tbl_dtls_compose where sender='$loginid'";
$result= mysql_query($sql2);
$no_of_record=mysql_num_rows($result); 
$recordsPerPage = 50;
if(!empty($_GET['search'])){
	$searchQuery = $_GET['search'];
}

$pageId= intval($_GET['page']);
if (empty($pageId)) {
	$pageId = 1;
}else{
	$pageId = intval($pageId); 
}
$paginator = new Paginator($pageId,$recordsPerPage,$query,$conn);
$paginator->debug = FALSE;
$paginator->fields = 'name';
$paginator->searchQuery = $searchQuery;
$rows = $paginator->paginate();
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Out Box</title>
<link href="css_paging_outbox/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js_paging_outbox/ajax.js"></script>
<script type="text/javascript" src="js_paging_outbox/ajaxUpdater.js"></script> 
<script type="text/javascript" src="js_paging_outbox/paginate.js"></script>
<script language='javascript'>

checked=false;
function checkedAll (frm1) {
	var aa= document.getElementById('frm1');
	 if (checked == false)
          {
           checked = true
          }
        else
          {
          checked = false
          }
	for (var i =0; i < aa.elements.length; i++) 
	{
	 aa.elements[i].checked = checked;
	}
      }
</script>
</head>
<body>
<div id="content">
<div id="wrapper">
<div id='search-box' class="search-box" style="padding-right:0px; padding-top:15px; border:none; margin-right:10px; ">
<form action="<?=$_SERVER['PHP_SELF']?>" onsubmit='paginate();return false;'>
<?php 
echo parse_str($_SERVER['QUERY_STRING'],$getArray);
foreach($getArray as $key=>$value){
echo "<input type='hidden' name='{$key}' id='{$key}' value='{$value}' />";
}
?>
<input id="search" type="text" class="search" />
<input type="submit" value="search" class="button" />
</form>
</div>
<div id="listing_container">
<table border="0" width="90%" id="table21" height="100%" cellspacing="1" style=" padding:10px">
<tr bgcolor="FF9966">
	<td height="29" colspan="9" align="left" valign="top" bgcolor="#C5D8EB">&nbsp;</td>
	</tr>
<tr>
	<td bgcolor="#E5E5E5" align="left" valign="top" width="1%">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top" width="5%">
	<img border="0" src="images/my_pag2.jpg"></td>
	<td bgcolor="#E5E5E5" align="left" width="91%" colspan="5">
	<span lang="en-us">&nbsp;</span><span lang="en-us" style="font-size: 8.5pt"><font face="Verdana" color="#006699"><b>OUTBOX</b></font></span></td>
    <td bgcolor="#E5E5E5" align="left" valign="top" width="1%">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top" width="5%">
</tr>
<tr>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top" colspan="5" bordercolor="#F2F2F2"></td>
    <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
</tr>
<tr>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td align="left" valign="top" colspan="5">
	<form name="myform" action="del3.php" method="request" id="frm1">
	<table border="1" bordercolor="#003366" style="border-style:solid; border-collapse:collapse" width="100%">
<tr>
	<td></td>
	<td width="9" height="15"><font color="#000000" face="Verdana">
		 <span style="font-size: 8.5pt; font-weight: 700">
		 EMAIL</span></font></td>
	<td width="9" height="22" colspan="2"><font color="#000000" face="Verdana">
		 <span style="font-size: 8.5pt; font-weight: 700">
		 MESSAGE</span></font></td>
	
	<td height="22"> <font color="#000000" face="Verdana">
					 <span style="font-size: 8.5pt; font-weight: 700">
					  DATE/TIME</span></font></td>
	<td width="22" height="22">
						<span style="font-weight: 700" lang="en-us">
						<font face="Verdana" style="font-size: 8.5pt" color="#000000">
						DELETE</font></span></td>
</tr>
									 
<?php 
 foreach($rows as $row)
   	{
?>


					<tr>
					<td width="26" height="22" bgcolor=""><input type="checkbox" name='ids[]' id="ids[]" value="<?php echo "$row[id]";?>"></td>
					<td bgcolor="" width="22"><font style="font-size: 8.5pt" face="Verdana" color="#000000">
					<?php echo "$row[receiver]";?></a>&nbsp;</font></td>
					<td bgcolor="" width="26" colspan="2">
					<font style="font-size: 8.5pt" face="Verdana" color="#000000"><a  style="text-decoration:none; color:#000000" href="qry1.php?srno=<?php echo "$row[id]"; ?>">
					<?php echo substr("$row[sub]"."-"."$row[message]",0,40);?></a></font>                    </td>
									    <td bgcolor="" width="26">
									      <font style="font-size: 8.5pt" face="Verdana" color="#000000">
									    <?php echo "$row[post_time]";?></font></td>
									    <td bgcolor="" width="26">
																				
										<font style="font-size: 8.5pt" face="Verdana" color="#000000">
								<a href="#" onClick="delete_confirm(<?php echo "$row[id]"; ?>)">
				  <img src="images/b_drop.png" border="0" /></a>							</font>							</td>
	</tr>								
									  <?php
									  }
									  ?>
									   <tr>
								        <td width="26" height="19">&nbsp;</td>
									    <td width="9" height="19">&nbsp;</td>
									    <td width="9" height="19" colspan="2">&nbsp;</td>
									    <td height="19" colspan=""></td>
									    <td width="84" height="19">&nbsp;</td>
		    </tr>
									  <tr>
								        <td bgcolor="#F2F2F2" width="26">&nbsp;</td>
									    <td bgcolor="#F2F2F2" colspan="3">&nbsp;
<input name="checkall" type="button" onclick='checkedAll(frm1);' value="Select All" style="border:1px solid #000000; font-size: 8pt; font-family: Verdana; "/>&nbsp;              
<!--<input name="button" type="button" onClick="javascript:SetChecked(1)" value="Select All" style="border:1px solid #000000; font-size: 8pt; font-family: Verdana; "/>&nbsp;-->
<input type="submit" value="Delete Selected" name="B1" style="border:1px solid #000000; font-size: 8pt; font-family: Verdana; "/></td></td>
<td bgcolor="#F2F2F2" width="84" colspan="2">&nbsp;</td>
</tr></table>
</form></td>
<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
 </tr>

         <tr>
            <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
								  <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
								  <td bgcolor="#E5E5E5" align="left" valign="top" colspan="5">
								    <font color="#000000" face="Verdana">
							        <span style="font-size: 8.5pt">						            </span></font></td>
                                    <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
								  <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
 </tr>
</table>	
<?php
$links = $paginator->getLinks ();
echo "<div class='paginator'> " . $links ;

echo "<p>Page " . $paginator->pageId . " of " . $paginator->totalPages . "</p>";

?>
	</div><!--end of paginator-->
	</div><!--end of wrapper-->
</div> <!-- end of content -->
</div>


</body>
</html>
<script language='javascript'>
//delete confirmation function
function delete_confirm(id)
{	
	if(confirm('Do you want to Delete if?'))
	{
		//redirection to delete.php script
		document.location='deleteall2.php?id='+id; 
	}
	
}
</script>

